package com.sun.sort.select;

import java.util.Arrays;

//选择排序
public class select1 {
    public static void main(String[] args) {
        int[] arr = {101,34,119,-1,2,1};
        ordinary(arr);
        System.out.println(Arrays.toString(arr));
        Integer i = 1299;
        Integer j = 1299;
        if (i != j){
            System.out.println("haha");
        }
    }
    public static void ordinary(int[] arr){
        for (int i = 0; i < arr.length - 1; i++) {
            int index = i;
            int sum = arr[i];
            for (int j = i; j < arr.length ; j++) {
                if (arr[index] > arr[j]){
                    index = j;
                    sum = arr[index];
                }
            }
            if (index != i) {
                arr[index] = arr[i];
                arr[i] = sum;
            }
        }
    }
}
